package ai.attackControllers;

import ai.AITools;

import com.jme.math.Vector3f;

import logic.common.player.Player;
import logic.nodes.TeamNode;
import logic.ships.hunter.Hunter;
import logic.weapons.Weapon;
import logic.weapons.WeaponFire;
import logic.weapons.WeaponType;
import logic.weapons.energyWeapons.EnergyWeapon;

public class HardAttackController extends AttackController {
	
	private static final long serialVersionUID = 1L;
	
	public HardAttackController(Player bot) {
		super(bot);
	}
	
	@Override
	protected void fireWeapons(Hunter hunter, TeamNode target) {
		Vector3f hunterLoc = hunter.getLocalTranslation();
		Vector3f targetDirection = target.getLocalTranslation().subtract(hunterLoc);
		
		for(Weapon w : hunter.getWeapons(WeaponType.Energy)) {
			Vector3f aimLocation = AITools.getEnergyFireLocation((EnergyWeapon)w, bot.getCurrentTarget());
			WeaponFire fire = w.fire(aimLocation.subtract(w.getFireSpotLocation()));
			if(fire != null) hunter.getIngameState().addNode(fire);
		}
		
		fireHeatSeeker(targetDirection);
	}
}